[id].vue 41 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083
  1. <template>
  2. <!-- 页面头部 -->
  3. <HomePageHead></HomePageHead>
  4. <!-- 导航栏 -->
  5. <HomePageNavigation></HomePageNavigation>
  6. <!-- 面包屑导航 -->
  7. <div class="breadcrumb-box">
  8. <div class="inner">
  9. <span class="location">当前位置:</span>
  10. <el-breadcrumb :separator-icon="ArrowRight">
  11. <el-breadcrumb-item>
  12. <NuxtLink to="/">首页</NuxtLink>
  13. </el-breadcrumb-item>
  14. <el-breadcrumb-item v-if="parent_children_count > 0">
  15. <NuxtLink :to="`/${parent_pinyin}/index.html`"> {{ parent_name }}</NuxtLink>
  16. </el-breadcrumb-item>
  17. <el-breadcrumb-item v-if="parent_children_count == 0">
  18. <NuxtLink :to="`/${parent_pinyin}/list-1.html`"> {{ parent_name }}</NuxtLink>
  19. </el-breadcrumb-item>
  20. <el-breadcrumb-item class="phone_breadcrumb_text" >{{ routeNewsTtitle }}</el-breadcrumb-item>
  21. </el-breadcrumb>
  22. </div>
  23. </div>
  24. <!-- 资讯列表 -->
  25. <div class="newsDetail">
  26. <div class="inner">
  27. <div class="innerLeft">
  28. <div class="LeftTop">
  29. <h1>{{ newsDetail.title }}</h1>
  30. <p>
  31. 来源: <span>{{ newsDetail.copyfrom }}</span>
  32. 作者: <span>{{ newsDetail.author }}</span>
  33. 发布时间: <span>{{ time }}</span>
  34. </p>
  35. </div>
  36. <div
  37. class="leftBottom"
  38. v-html="newsDetail.content"
  39. v-if="newsDetail.content"
  40. @click="openPreview">
  41. </div>
  42. <div v-if="previewVisible" class="preview-modal" @click="closePreview">
  43. <img :src="selectedImage" alt="Preview">
  44. </div>
  45. <!-- 免责声明: -->
  46. <div class="disclaimer" v-if="newsDetail.copyfrom!='本网'">
  47. <p>原文链接:{{ newsDetail.fromurl }}</p>
  48. <p>[免责声明]本文来源于网络转载,仅供学习交流使用,不构成商业目的。 版权归原作者所有,如涉及作品内容,版权和其他问题,请在30日与本网联系,我们将第一时间处理。</p>
  49. </div>
  50. <div v-if="articleChoice">
  51. <!-- 投票 start ---------------------------------------->
  52. <div class="index_3_box_vote" v-if="articleChoice">
  53. <div class="voteTitle">投票区</div>
  54. <div class="inquire">
  55. <p v-if="voteList.length>0">{{voteList[0].survey_name}}</p>
  56. <div class="radioBox">
  57. <!--投票选项-->
  58. <div v-if="!isDisabled">
  59. <div class="radio" v-if="isRadio">
  60. <el-radio-group v-model="radio1" @change="handleRadioChange">
  61. <el-radio v-for="item in voteList" :key="item.id" :value="item.id" size="large">
  62. <span v-if="item.is_other == 0">{{item.choice_name}}</span>
  63. <span v-else>其他</span>
  64. </el-radio>
  65. </el-radio-group>
  66. <el-input
  67. v-if="showUserChoice"
  68. v-model="userChoice"
  69. :rows="2"
  70. type="textarea"
  71. resize="none"
  72. placeholder="请输入.."
  73. />
  74. </div>
  75. <div class="checkInputBox" v-else>
  76. <el-checkbox-group v-model="check1" @change="handleCheckboxChange">
  77. <span v-for="item in voteList" :key="item.id">
  78. <span v-if="item.is_other == 0">
  79. <el-checkbox size="large" :label="item.choice_name" :value="item.id"/>
  80. </span>
  81. <span v-else>
  82. <el-checkbox size="large" label="其他" :value="item.id"/>
  83. </span>
  84. </span>
  85. </el-checkbox-group>
  86. <el-input
  87. v-if="showUserChoice"
  88. v-model="userChoice"
  89. :rows="2"
  90. type="textarea"
  91. resize="none"
  92. placeholder="请输入.."
  93. />
  94. </div>
  95. </div>
  96. <!--投票结果-->
  97. <div class="inquireData" v-else>
  98. <div v-for="item in websiteSurveyData.data" :key="item.id">
  99. <div class="inquireDataItem active" v-if="item.status == 1">
  100. <div class="inquireDataItemTitle">
  101. <span v-if="item.choice_name == ''">其他</span>
  102. <span v-else>{{item.choice_name}}</span>
  103. </div>
  104. <div class="inquireDataItemNum">{{item.results}}票</div>
  105. </div>
  106. <div class="inquireDataItem" v-else>
  107. <div class="inquireDataItemTitle">
  108. <span v-if="item.choice_name == ''">其他</span>
  109. <span v-else>{{item.choice_name}}</span>
  110. </div>
  111. <div class="inquireDataItemNum">{{item.results}}票</div>
  112. </div>
  113. </div>
  114. </div>
  115. </div>
  116. <div class="btn">
  117. <button class="voting" @click="addWebsiteSurvey" :disabled="isDisabled" v-if="!isDisabled">投票</button>
  118. </div>
  119. </div>
  120. </div>
  121. <!-- 投票 end ---------------------------------------->
  122. </div>
  123. <div class="recommendRead" v-if="newsDetail.commendArticle != false">
  124. <div class="recommendReadTitle">
  125. <span class="read_title">
  126. 推荐阅读
  127. </span>
  128. </div>
  129. <div class="recommendReadList">
  130. <div class="recommendReadListTitle" v-for="(item, index) in newsDetail.commendArticle"
  131. :key="item.id">
  132. <a :href="`/${item.alias_pinyin}/${item.id}.html`" v-if="index < 3">
  133. {{ item.title }}
  134. </a>
  135. </div>
  136. </div>
  137. </div>
  138. <!--上一篇 下一篇-->
  139. <div class="prevNext">
  140. <NuxtLink to="/">上一篇:李强签署国务院令 公布《行政执法监督条例》</NuxtLink>
  141. <NuxtLink to="/">下一篇:没有了</NuxtLink>
  142. </div>
  143. </div>
  144. <div class="innerRight">
  145. <!-- 热点资讯1 -->
  146. <!-- <div class="hotList1">
  147. <DetailHotNews></DetailHotNews>
  148. </div> -->
  149. <!-- 热点资讯2 -->
  150. <div class="hotList2">
  151. <DetailHotNews2></DetailHotNews2>
  152. </div>
  153. </div>
  154. </div>
  155. </div>
  156. <!-- 页面底部 -->
  157. <HomeFoot></HomeFoot>
  158. </template>
  159. <script setup>
  160. //1.页面依赖 start ---------------------------------------->
  161. import { onMounted } from 'vue'
  162. import { ElBreadcrumb, ElBreadcrumbItem,ElRadio, ElRadioGroup,ElCheckbox,ElCheckboxGroup,ElMessage,ElInput } from 'element-plus'
  163. import { ArrowRight } from '@element-plus/icons-vue'
  164. const nuxtApp = useNuxtApp();
  165. const axios = nuxtApp.$axios;
  166. //1.1 获得跳转过来的id
  167. const route = useRoute();
  168. //获得详情id
  169. const articleId = parseInt(route.params.id); //获得该页面的id
  170. //获得当前的完整路径
  171. const fullPath = route.path;
  172. //拆分,取出来中间这一段,然后提取数字部分
  173. const segments = fullPath.split('/');
  174. const targetSegment = segments[1];
  175. // const numberPart = targetSegment.match(/\d+$/)?.[0];
  176. // let routeId = 20 //排除路径错误可以打开这个
  177. // const routeId = numberPart;
  178. let routeId;
  179. //通过导航路径反向查询导航id
  180. const getRouteId = await requestDataPromise('/web/getWebsiteRoute', {
  181. method: 'GET',
  182. query: {
  183. 'pinyin': targetSegment,
  184. },
  185. });
  186. if(getRouteId.code == 200){
  187. routeId = getRouteId.data.category_id
  188. }else{
  189. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  190. console.log("错误位置:通过url路径查询导航池id")
  191. console.log("后端错误反馈:",getRouteId.message)
  192. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  193. }
  194. //1.2 获得父级栏目的名称、id
  195. const parent_name = ref([]);
  196. const parent_id = ref([]);
  197. const parent_pinyin = ref("");
  198. const parent_children_count = ref(0)
  199. let getParentNav = async () => {
  200. const listData = await requestDataPromise('/web/getOneWebsiteCategory', {
  201. method: 'GET',
  202. query: {
  203. 'catid': routeId
  204. },
  205. });
  206. console.log("获取父级栏目数据")
  207. console.log(listData)
  208. if (listData.code == 200) {
  209. console.log(listData.data);
  210. parent_name.value = listData.data.alias;
  211. parent_id.value = listData.data.parent_id;
  212. parent_pinyin.value = listData.data.aLIas_pinyin;
  213. parent_children_count.value = listData.data.children_count;
  214. } else {
  215. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  216. console.log("错误位置:获取面包屑导航")
  217. console.log("后端错误反馈:", listData.message)
  218. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  219. }
  220. }
  221. //获得父级栏目详情
  222. getParentNav();
  223. //1.页面依赖 end ---------------------------------------->
  224. //2.页面数据 start ---------------------------------------->
  225. //2.1 资讯详情
  226. const newsDetail = ref({})
  227. const routeNewsTtitle = ref("");
  228. //2.2 发布日期
  229. const time = ref("");
  230. //2.3 路径
  231. const routLevelTitle = ref("");
  232. const routLevelId = ref("");
  233. //是否展示投票
  234. const articleChoice = ref(false);
  235. //2.4获取详情
  236. async function getPageData() {
  237. const mkdata = await requestDataPromise('/web/selectWebsiteArticleInfo', {
  238. method: 'GET',
  239. query: {
  240. 'articleid': articleId
  241. },
  242. });
  243. if(mkdata.code==200){
  244. //判断是否显示投票
  245. if(mkdata.data.is_survey==1){
  246. console.log("本篇文章含有投票!")
  247. articleChoice.value = true;
  248. getVoteList();
  249. }
  250. //获取内容
  251. newsDetail.value = mkdata.data;
  252. //获取路径
  253. routLevelTitle.value = newsDetail.value.cat_name;
  254. routLevelId.value = newsDetail.value.category_id;
  255. //获取发布时间
  256. time.value = newsDetail.value.updated_at.split(' ')[0];
  257. //修正标题长度
  258. if (newsDetail.value.title.length >= 30) {
  259. routeNewsTtitle.value = newsDetail.value.title.substr(0, 30) + "...";
  260. } else {
  261. routeNewsTtitle.value = newsDetail.value.title
  262. }
  263. }else{
  264. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  265. console.log("错误位置:获取详情内容")
  266. console.log("后端错误反馈:",mkdata.message)
  267. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  268. }
  269. }
  270. getPageData();
  271. //2.5 获得广告
  272. //广告列表
  273. let adImg1 = ref([]);
  274. // async function getAdData(){
  275. // const adData = await requestDataPromise('/web/getWebsiteAdvertisement',{method:'GET',query:{'ad_tag':'DETAIL'}});
  276. // if(adData.code==200){
  277. // for(let item of adData.data){
  278. // if(item.ad_tag == 'DETAIL_0001'){
  279. // adImg1.value = item;
  280. // }
  281. // }
  282. // }else{
  283. // console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  284. // console.log("错误位置:获取详情页广告列表")
  285. // console.log("后端错误反馈:",adData.message)
  286. // console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  287. // }
  288. // }
  289. // getAdData();
  290. onMounted(async () => {
  291. const { $webUrl, $CwebUrl } = useNuxtApp();
  292. //广告1
  293. let url = `${$webUrl}/web/getWebsiteAdvertisement?ad_tag=snzxw_detail_0001`
  294. const responseAd1 = await fetch(url, {
  295. headers: {
  296. 'Content-Type': 'application/json',
  297. 'Userurl': $CwebUrl,
  298. 'Origin': $CwebUrl
  299. }
  300. });
  301. const resultAd1 = await responseAd1.json();
  302. adImg1.value = resultAd1.data[0];
  303. })
  304. //2.页面数据 end ---------------------------------------->
  305. //3.设置seo信息 start---------------------------------------->
  306. //3.1 设置seo信息
  307. const setData = await requestDataPromise('/web/selectWebsiteArticleInfo', {
  308. method: 'GET',
  309. query: {
  310. 'articleid': articleId
  311. },
  312. });
  313. if(setData.code==200){
  314. let seoTitle = setData.data.title;
  315. let seoDescription = setData.data.introduce;
  316. let seoKeywords = setData.data.keyword;
  317. let seoSuffix = setData.data.suffix;
  318. let seoName = setData.data.website_name;
  319. useSeoMeta({
  320. title: seoTitle + "_" + seoName + "_" + seoSuffix,
  321. meta: [
  322. { name: 'description', content: seoDescription + "_" + seoName + "_" + seoSuffix , tagPriority: 10 },
  323. { name: 'keywords', content: seoKeywords + "_" + seoName + "_" + seoSuffix , tagPriority: 10 },
  324. { name: 'viewport', content: 'width=device-width,initial-scale=1,user-scalable=no',tagPriority: 10 }
  325. ]
  326. });
  327. }else{
  328. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  329. console.log("错误位置:设置详情页面SEO数据")
  330. console.log("后端错误反馈:",setData.message)
  331. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  332. }
  333. //3.设置seo信息 end---------------------------------------->
  334. //4.投票 start---------------------------------------->
  335. const radio1 = ref(''); //单选
  336. const check1 = ref([]); //多选
  337. const isDisabled = ref(false);//是否禁用提交按钮
  338. const isRadio = ref(true);//是否渲染单选
  339. const userSurId = ref('');//投票属于哪一篇文章
  340. const userChoice = ref('');//用于判断用户选择了其他选项以后,输入的值
  341. const userIsChoice = ref('');//用于判断其他选项目前是什么值
  342. const showUserChoice = ref(false);//是否显示其他输入框
  343. const websiteSurveyData = ref([]);//投票结果
  344. //3.2获得投票列表
  345. let voteList = ref([]);
  346. async function getVoteList(){
  347. const voteData = await requestHome('/web/getWebsiteSurvey',{method:'GET',query:{'art_id':articleId}});
  348. console.log(778899)
  349. console.log(voteData)
  350. if(voteData.code == 200){
  351. voteList.value = voteData.data;
  352. console.log(voteList.value)
  353. //判断显示单选还是多选
  354. //survey_type 0是单选 1是多选
  355. if(voteData.data[0].survey_type == 0){
  356. isRadio.value = true;
  357. console.log("1111")
  358. }else{
  359. isRadio.value = false;
  360. }
  361. //把最后一个的值拿出来 用于判断用户是否选择了其他
  362. for(let item of voteData.data){
  363. //如果含有其他
  364. if(item.is_other==1){
  365. userIsChoice.value = item.id;
  366. }
  367. }
  368. //用户投票属于哪一篇文章
  369. userSurId.value = voteData.data[0].sur_id;
  370. }else{
  371. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  372. console.log("错误位置:首页投票")
  373. console.log("后端错误反馈:",voteData.message)
  374. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  375. }
  376. }
  377. //3.2当用户选择了选项,判断是否展示其他输入框
  378. const handleRadioChange = (value) => {
  379. if(value == userIsChoice.value){
  380. showUserChoice.value = true;
  381. }else{
  382. showUserChoice.value = false;
  383. }
  384. }
  385. const handleCheckboxChange = (value) => {
  386. if (value.includes(userIsChoice.value)) {
  387. showUserChoice.value = true;
  388. } else {
  389. showUserChoice.value = false;
  390. }
  391. }
  392. //3.2发起投票
  393. async function addWebsiteSurvey(){
  394. //判断当前是单选还是多选
  395. console.log(isRadio.value)
  396. if(isRadio.value){
  397. console.log("用户单选!")
  398. if(radio1.value!=''){
  399. //先判断一下是否使用了其他选项
  400. if(showUserChoice.value){
  401. if(userChoice.value!=''){
  402. //文章id
  403. // console.log(userSurId.value)
  404. // 用户输入的值
  405. // console.log(userChoice.value)
  406. //如果使用了其他,其他的选项需要增加进去
  407. const ChoiceData = await requestHome('/web/addWebsiteSurveyOption',{
  408. method:'GET',
  409. query:{
  410. 'sur_id':userSurId.value,//投票的新闻id
  411. 'choice_name':userChoice.value,//投票的选项id
  412. }
  413. });
  414. if(ChoiceData.code == 200){
  415. //提交完其他选项以后,再正式发起投票
  416. const mkData = await requestHome('/web/addWebsiteSurveyVote',{
  417. method:'GET',
  418. query:{
  419. 'sur_id':userSurId.value,
  420. 'choice_id':ChoiceData.data
  421. }
  422. });
  423. if(mkData.code == 200){
  424. ElMessage.success('投票成功!')
  425. //把投票结果显示到页面上 禁用投票按钮
  426. isDisabled.value = true;
  427. websiteSurveyData.value = mkData.data;
  428. //遍历一下,把用户选中的那个设置status为1
  429. let data = mkData.data;
  430. //遍历一下,把用户选中的那个设置status为1
  431. for(let item of data.data){
  432. for(let i of data.choice){
  433. if(item.id == i){
  434. console.log(item.id)
  435. item.status = 1;
  436. }
  437. }
  438. }
  439. websiteSurveyData.value = data;
  440. }else{
  441. ElMessage.error(mkData.message)
  442. }
  443. }else{
  444. ElMessage.error('其他投票失败!')
  445. }
  446. }else{
  447. ElMessage.error('请输入选项内容!')
  448. }
  449. }else{
  450. //如果没选择其他,直接提交选择的内容
  451. const mkData = await requestHome('/web/addWebsiteSurveyVote',{
  452. method:'GET',
  453. query:{
  454. 'sur_id':userSurId.value,
  455. 'choice_id':radio1.value
  456. }
  457. });
  458. if(mkData.code == 200){
  459. ElMessage.success('投票成功!')
  460. //把投票结果显示到页面上 禁用投票按钮
  461. isDisabled.value = true;
  462. let data = mkData.data;
  463. //遍历一下,把用户选中的那个设置status为1
  464. for(let item of data.data){
  465. for(let i of data.choice){
  466. if(item.id == i){
  467. item.status = 1;
  468. }
  469. }
  470. }
  471. websiteSurveyData.value = data;
  472. }else{
  473. ElMessage.error('投票失败!')
  474. }
  475. }
  476. }else{
  477. ElMessage.error('请选择一个选项')
  478. }
  479. }else{
  480. console.log("多选!")
  481. //多选
  482. if(check1.value!=[]){
  483. //先判断一下是否使用了其他选项
  484. if(showUserChoice.value){
  485. if(userChoice.value!=''){
  486. //判断用户是否只选择了一个其他
  487. if(check1.value.length == 1){
  488. const ChoiceData = await requestDataPromise('/web/addWebsiteSurveyOption',{
  489. method:'GET',
  490. query:{
  491. 'sur_id':userSurId.value,//投票的新闻id
  492. 'choice_name':userChoice.value,//用户输入的其他选项文字
  493. }
  494. });
  495. if(ChoiceData.code == 200){
  496. //提交完其他选项以后,再正式发起投票
  497. const mkData = await requestDataPromise('/web/addWebsiteSurveyVote',{
  498. method:'GET',
  499. query:{
  500. 'sur_id':userSurId.value,
  501. 'choice_id':ChoiceData.data
  502. }
  503. });
  504. if(mkData.code == 200){
  505. ElMessage.success('投票成功!')
  506. //把投票结果显示到页面上 禁用投票按钮
  507. isDisabled.value = true;
  508. websiteSurveyData.value = mkData.data;
  509. //遍历一下,把用户选中的那个设置status为1
  510. let data = mkData.data;
  511. //遍历一下,把用户选中的那个设置status为1
  512. for(let item of data.data){
  513. for(let i of data.choice){
  514. if(item.id == i){
  515. console.log(item.id)
  516. item.status = 1;
  517. }
  518. }
  519. }
  520. websiteSurveyData.value = data;
  521. }else{
  522. ElMessage.error(mkData.message)
  523. }
  524. }else{
  525. ElMessage.error('其他投票失败!')
  526. }
  527. }else{
  528. //用户选择了除了其他以外,还包括别的选项
  529. const ChoiceData = await requestDataPromise('/web/addWebsiteSurveyOption',{
  530. method:'GET',
  531. query:{
  532. 'sur_id':userSurId.value,//投票的新闻id
  533. 'choice_name':userChoice.value,//用户输入的其他选项文字
  534. }
  535. });
  536. if(ChoiceData.code == 200){
  537. let data = check1.value;
  538. //找到多选的数组,把其他默认值给替换掉
  539. for (let i = 0; i < data.length; i++) {
  540. if (data[i] == userIsChoice.value) {
  541. data[i] = ChoiceData.data;
  542. }
  543. }
  544. let jsonArray = JSON.stringify(data);
  545. //提交完其他选项以后,再正式发起投票
  546. const mkData = await requestDataPromise('/web/addWebsiteSurveyVote',{
  547. method:'GET',
  548. query:{
  549. 'sur_id':userSurId.value,
  550. 'choice_id':jsonArray
  551. }
  552. });
  553. if(mkData.code == 200){
  554. ElMessage.success('投票成功!')
  555. //把投票结果显示到页面上 禁用投票按钮
  556. isDisabled.value = true;
  557. websiteSurveyData.value = mkData.data;
  558. //遍历一下,把用户选中的那个设置status为1
  559. let data = mkData.data;
  560. //遍历一下,把用户选中的那个设置status为1
  561. for(let item of data.data){
  562. for(let i of data.choice){
  563. if(item.id == i){
  564. //console.log(item.id)
  565. item.status = 1;
  566. }
  567. }
  568. }
  569. websiteSurveyData.value = data;
  570. }else{
  571. ElMessage.error(mkData.message)
  572. }
  573. }else{
  574. ElMessage.error('其他投票失败!')
  575. }
  576. }
  577. }else{
  578. ElMessage.error('请输入选项内容!')
  579. }
  580. }else{
  581. let jsonArray = JSON.stringify(check1.value);
  582. //如果没选择其他,直接提交选择的内容
  583. const mkData = await requestDataPromise('/web/addWebsiteSurveyVote',{
  584. method:'GET',
  585. query:{
  586. 'sur_id':userSurId.value,
  587. 'choice_id':jsonArray
  588. }
  589. });
  590. if(mkData.code == 200){
  591. ElMessage.success('投票成功!')
  592. //把投票结果显示到页面上 禁用投票按钮
  593. isDisabled.value = true;
  594. websiteSurveyData.value = mkData.data;
  595. //遍历一下,把用户选中的那个设置status为1
  596. let data = mkData.data;
  597. //遍历一下,把用户选中的那个设置status为1
  598. for(let item of data.data){
  599. for(let i of data.choice){
  600. if(item.id == i){
  601. console.log(item.id)
  602. item.status = 1;
  603. }
  604. }
  605. }
  606. websiteSurveyData.value = data;
  607. }else{
  608. ElMessage.error('投票失败!')
  609. }
  610. }
  611. }else{
  612. ElMessage.error('请选择一个选项')
  613. }
  614. }
  615. }
  616. //4.投票 end---------------------------------------->
  617. //5.页面图片放大 start---------------------------------------->
  618. const previewVisible = ref(false)
  619. const selectedImage = ref(' ')
  620. const openPreview = (event) => {
  621. if (event.target.tagName === 'IMG') {
  622. selectedImage.value = event.target.src;
  623. previewVisible.value = true;
  624. }
  625. }
  626. const closePreview = () => {
  627. previewVisible.value = false;
  628. }
  629. //5.页面图片放大 end---------------------------------------->
  630. </script>
  631. <style lang="less" scoped>
  632. //@import url('@/assets/css/article/pc.less');
  633. //@import url('@/assets/css/article/yd.less');
  634. //面包屑
  635. .breadcrumb-box {
  636. width: 1400px;
  637. margin: 0 auto;
  638. .inner {
  639. width: 100%;
  640. height: 22px;
  641. margin-top: 20px;
  642. margin-bottom: 20px;
  643. font-family: Microsoft YaHei, Microsoft YaHei;
  644. font-weight: 400;
  645. font-size: 20px;
  646. color: #666666;
  647. line-height: 23px;
  648. text-align: left;
  649. font-style: normal;
  650. text-transform: none;
  651. display: flex;
  652. align-items: center;
  653. border-bottom: 1px dashed #ccc;
  654. margin-bottom: 10px;
  655. padding: 20px 20px 20px 0;
  656. box-sizing: border-box;
  657. a {
  658. font-size: 16px;
  659. color: #000;
  660. line-height: 20px;
  661. }
  662. span {
  663. font-size: 16px;
  664. color: #000;
  665. line-height: 20px;
  666. &.location {
  667. line-height: 20px;
  668. }
  669. }
  670. }
  671. }
  672. //资讯详情
  673. .newsDetail {
  674. width: 100%;
  675. margin-bottom: 10px;
  676. .inner {
  677. width: 1400px;
  678. overflow: hidden;
  679. font-size: 16px;
  680. display: flex;
  681. align-items: flex-start;
  682. justify-content: space-between;
  683. .innerLeft {
  684. width: 1030px;
  685. .LeftTop {
  686. margin-top: 20px;
  687. border-bottom: 1px dashed #ccc;
  688. padding-bottom: 20px;
  689. >h1 {
  690. line-height: 40px;
  691. margin-bottom: 20px;
  692. font-family: Microsoft YaHei, Microsoft YaHei;
  693. font-weight: bold;
  694. font-size: 24px;
  695. color: #333333;
  696. text-align: center;
  697. }
  698. >p {
  699. height: 18px;
  700. line-height: 18px;
  701. font-family: Microsoft YaHei, Microsoft YaHei;
  702. font-weight: 400;
  703. font-size: 14px;
  704. color: #999999;
  705. text-align: center;
  706. span {
  707. margin-right: 40px;
  708. }
  709. }
  710. >img {
  711. width: 680px;
  712. height: 382px;
  713. padding: 50px 0px 60px 55px;
  714. }
  715. }
  716. .leftBottom {
  717. margin-top: 20px;
  718. font-size: 20px;
  719. line-height: 38px;
  720. margin-bottom: 30px;
  721. word-break:break-all;
  722. ul>li img {
  723. width: 790px;
  724. height: 382px;
  725. }
  726. img {
  727. width: 790px;
  728. height: 382px;
  729. }
  730. p.tinymce-material {
  731. img {
  732. width: 790px;
  733. }
  734. }
  735. >h3,
  736. >p {
  737. text-indent: 2em;
  738. width: 790px;
  739. font-family: Microsoft YaHei, Microsoft YaHei;
  740. font-size: 20px;
  741. color: #333333;
  742. line-height: 38px;
  743. padding-bottom: 30px;
  744. img {
  745. width: 790px;
  746. }
  747. }
  748. >h3 {
  749. font-weight: 600px;
  750. }
  751. >p {
  752. font-weight: 400;
  753. }
  754. }
  755. .disclaimer {
  756. width: 790px;
  757. overflow: hidden;
  758. border-top: 1px solid #e6e6e6;
  759. padding: 30px 0px;
  760. color: #999999;
  761. font-size: 17px;
  762. p {
  763. width: 790px;
  764. line-height: 30px;
  765. }
  766. }
  767. .recommendRead {
  768. width: 100%;
  769. margin: 30px 0px 20px 0;
  770. .recommendReadTitle {
  771. font-size: 18px;
  772. color: #001996;
  773. height: 42px;
  774. line-height: 35px;
  775. letter-spacing: 1px;
  776. text-align: left;
  777. font-style: normal;
  778. text-transform: none;
  779. border-bottom: 1px solid #D9D9D9;
  780. .read_title {
  781. display: inline-block;
  782. text-align: center;
  783. width: 94px;
  784. height: 40px;
  785. border-bottom: 2px solid #158d91;
  786. }
  787. }
  788. .recommendReadList {
  789. min-height: 155px;
  790. margin-top: 20px;
  791. padding-bottom: 10px;
  792. font-size: 16px;
  793. border-bottom: 1px solid #D9D9D9;
  794. .recommendReadListTitle {
  795. margin-top: 18px;
  796. a {
  797. &:hover {
  798. color: #158d91;
  799. }
  800. color: #333333;
  801. }
  802. }
  803. .recommendReadListTitle:nth-child(1)::after {
  804. content: "热";
  805. margin-left: 13px;
  806. background: #FF8A37;
  807. color: #fff;
  808. font-size: 14px;
  809. padding: 0px 2px;
  810. }
  811. .recommendReadListTitle:hover a {
  812. color: #158d91;
  813. }
  814. }
  815. }
  816. }
  817. .innerRight {
  818. width: 315px;
  819. overflow: hidden;
  820. border-top: 1px solid #139602;
  821. .hotList1 {
  822. margin-bottom: 50px;
  823. }
  824. }
  825. }
  826. }
  827. .leftBottom::v-deep p img,
  828. .leftBottom::v-deep img,
  829. .leftBottom::v-deep video {
  830. max-width: 700px;
  831. }
  832. .leftBottom::v-deep h1,
  833. .leftBottom::v-deep h2,
  834. .leftBottom::v-deep h3,
  835. .leftBottom::v-deep h4,
  836. .leftBottom::v-deep h5,
  837. .leftBottom::v-deep h6 {
  838. font-size: 20px;
  839. font-weight: 500;
  840. }
  841. //投票
  842. .index_3_box_vote {
  843. .voteTitle {
  844. font-size: 20px;
  845. height: 40px;
  846. line-height: 40px;
  847. color: #333333;
  848. padding-left: 20px;
  849. width: 100%;
  850. border-bottom: 1px solid #E7E7E7;
  851. border-top: 1px solid #139602;
  852. box-sizing: border-box;
  853. }
  854. width:100%;
  855. box-sizing:border-box;
  856. border:solid 1px #FBFBFB;
  857. background: #FBFBFB;
  858. .inquire {
  859. height: 394px;
  860. margin-top: 20px;
  861. border-radius: 6px 6px 6px 6px;
  862. padding: 4px 40px 4px 6px;
  863. box-sizing: border-box;
  864. p {
  865. font-weight: bold;
  866. height: 69px;
  867. font-family: PingFang SC, PingFang SC;
  868. font-size: 20px;
  869. color: #333333;
  870. line-height: 21px;
  871. text-align: left;
  872. font-style: normal;
  873. text-transform: none;
  874. padding: 12px 20px 0 32px;
  875. }
  876. .radioBox {
  877. height: 250px;
  878. padding-left: 30px;
  879. overflow-y: auto;
  880. box-sizing: border-box;
  881. padding-bottom: 20px;
  882. }
  883. .radio {
  884. /deep/.el-radio {
  885. --el-radio-input-border-color-hover: #27881a;
  886. }
  887. /deep/.el-radio-group {
  888. align-items: center;
  889. display: inline-flex;
  890. flex-wrap: wrap;
  891. font-size: 0;
  892. //padding-left: 35px;
  893. }
  894. /deep/.el-radio.el-radio--large {
  895. width: 100%;
  896. height: 29px;
  897. margin-bottom: 15px;
  898. }
  899. /deep/.el-radio.el-radio--large .el-radio__label {
  900. font-family: PingFang SC, PingFang SC;
  901. font-weight: 400;
  902. font-size: 16px;
  903. color: #333333;
  904. white-space: nowrap;
  905. overflow: hidden;
  906. text-overflow: ellipsis;
  907. width: 300px;
  908. }
  909. /deep/.el-radio.el-radio--large .el-radio__inner {
  910. height: 16px;
  911. width: 16px;
  912. }
  913. /deep/.el-radio__input.is-checked+.el-radio__label {
  914. color: #27881a;
  915. }
  916. /deep/.el-radio__input.is-checked .el-radio__inner {
  917. background: #33b023;
  918. border-color: #27881a;
  919. }
  920. }
  921. .checkInputBox {
  922. /deep/.el-checkbox {
  923. --el-radio-input-border-color-hover: #27881a;
  924. }
  925. /deep/.el-checkbox-group {
  926. align-items: center;
  927. display: inline-flex;
  928. flex-wrap: wrap;
  929. font-size: 0;
  930. //padding-left: 35px;
  931. }
  932. /deep/.el-checkbox.el-checkbox--large {
  933. width: 330px;
  934. height: 29px;
  935. margin-bottom: 15px;
  936. }
  937. /deep/.el-checkbox.el-checkbox--large .el-checkbox__label {
  938. font-family: PingFang SC, PingFang SC;
  939. font-weight: 400;
  940. font-size: 16px;
  941. color: #333333;
  942. white-space: nowrap;
  943. overflow: hidden;
  944. text-overflow: ellipsis;
  945. width: 300px;
  946. }
  947. /deep/.el-checkbox.el-checkbox--large .el-checkbox__inner {
  948. height: 16px;
  949. width: 16px;
  950. }
  951. /deep/.el-checkbox__input.is-checked+.el-checkbox__label {
  952. color: #27881a;
  953. }
  954. /deep/.el-checkbox__input.is-checked .el-checkbox__inner {
  955. background: #33b023;
  956. border-color: #27881a;
  957. }
  958. }
  959. .btn {
  960. padding-left: 30px;
  961. button {
  962. width: 78px;
  963. height: 37px;
  964. line-height: 37px;
  965. border-radius: 6px;
  966. border: none;
  967. font-family: PingFang SC, PingFang SC;
  968. font-weight: 400;
  969. font-size: 16px;
  970. color: #999999;
  971. }
  972. .voting {
  973. background-color: #49A769;
  974. color: #fff;
  975. margin-right: 44px;
  976. cursor: pointer;
  977. }
  978. .look {
  979. cursor: pointer;
  980. }
  981. }
  982. }
  983. .inquireData {
  984. .inquireDataItem {
  985. width: 100%;
  986. height: 38px;
  987. display: flex;
  988. align-items: center;
  989. justify-content: space-between;
  990. background: #F3F3F3;
  991. border: 1px solid #D2D2D2;
  992. margin-bottom: 10px;
  993. border-radius: 6px;
  994. padding: 0 15px;
  995. box-sizing: border-box;
  996. color: #999999;
  997. .inquireDataItemTitle {
  998. width: 290px;
  999. height: 38px;
  1000. font-size: 16px;
  1001. line-height: 38px;
  1002. white-space: nowrap;
  1003. overflow: hidden;
  1004. text-overflow: ellipsis;
  1005. }
  1006. .inquireDataItemNum {
  1007. font-size: 16px;
  1008. }
  1009. }
  1010. .active {
  1011. color: #49A769;
  1012. background: #dff7e8;
  1013. border: 1px solid #49A769;
  1014. }
  1015. }
  1016. }
  1017. //放大图片
  1018. .preview-modal {
  1019. position: fixed;
  1020. top: 0;
  1021. left: 0;
  1022. width: 100%;
  1023. height: 100%;
  1024. background: rgba(0, 0, 0, 0.8);
  1025. display: flex;
  1026. justify-content: center;
  1027. align-items: center;
  1028. z-index: 1000;
  1029. }
  1030. .preview-modal img {
  1031. max-width: 100%;
  1032. max-height: 100%;
  1033. cursor: pointer;
  1034. }
  1035. //上一篇 下一篇
  1036. .prevNext {
  1037. border-bottom: 1px solid #ccc;
  1038. padding-bottom: 10px;
  1039. a {
  1040. display: block;
  1041. color: #333;
  1042. font-size: 15px;
  1043. display: block;
  1044. height: 40px;
  1045. line-height: 40px;
  1046. &:hover {
  1047. color: #0071B7;
  1048. }
  1049. }
  1050. }
  1051. </style>